<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>今日菜价</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../plugins/mui/mui.min.css" rel="stylesheet" />
		<script src="../../js/statistics.js"></script>
		<script src="../../js/fontset.js"></script>
		<link rel="stylesheet"  href="../../css/life_housekeeper/vegetable_index.css"/>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav header">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">今日菜价</h1>
		</header>
		
		<div class="mui-content list-content">
			<div class="mui-slider">
				<div class="mui-slider-group">
					<div class="mui-slider-item">
				    	<div class="swiper-box">
				    		<div class="swiper-img">
								<img src="../../images/icon/life_housekeeper/vg-bg2.png" alt="溧阳菜价" class="img-response"/>
								<div class="swiper-info">
									<h5>溧阳菜价</h5>
									<p>乐享平价 新鲜优惠</p>
								</div>
							</div>
							<div class="swiper-indicator-default"></div>
				    	</div>
				      	<div id="contentList"></div>
				    </div>
				    <div class="mui-slider-item">
				      	<div class="swiper-box">
				      		<div class="swiper-img">
								<img src="../../images/icon/life_housekeeper/vg-bg1.png" alt="常州菜价" class="img-response"/>
								<div class="swiper-info">
									<h5>常州菜价</h5>
									<p>菜场菜价 尽收眼底</p>
								</div>
							</div>
							<div class="swiper-indicator-default"></div>
				      	</div>
						<ul class="mui-table-view ">
					        <li class="mui-table-view-cell">
					            <a class="mui-navigate-right" data-href="http://wx.jgtong.com.cn/wx/clz/LjtscPrice.html">
					               <i class="icon icon-wholesale"></i>凌家塘批发价
					            </a>
					        </li>
					        <li class="mui-table-view-cell">
					            <a class="mui-navigate-right" data-href="http://wx.jgtong.com.cn/wx/clz/NmscPrice.html">
					                <i class="icon icon-farm"></i>农贸市场价格
					            </a>
					        </li>
					        <li class="mui-table-view-cell">
					            <a class="mui-navigate-right" data-href="http://wx.jgtong.com.cn/wx/clz/PjsdPrice.html">
					                 <i class="icon icon-shop"></i>平价商店价格
					            </a>
					        </li>
					   </ul> 
				    </div> 
				</div>
			  	<div class="mui-slider-indicator swiper-indicator-box">
			  		<div class="mui-indicator mui-active"></div>
			  		<div class="mui-indicator"></div>
			  	</div>
			</div>
		</div>
		<script src="../../plugins/mui/mui.min.js"></script>
		<script src="../../js/getApiToken.js"></script>
		<script src="../../js/md5.js" ></script>
		<script src="../../js/life_housekeeper/windowTitleView.js"></script>
		<script src="../../plugins/template/template.js"></script>
		<script type="text/html" id="list">
			<ul class="mui-table-view vg-list">
				{{if data.length}}
					{{each data as item i}}
					<li class="mui-table-view-cell">
			            <a class="mui-navigate-right" data-id='{{item.id}}'>
			            	{{if (i+1)%3 == 1}}
			            	  {{if item.images}}
			            	  <i class="icon"><img src="{{baseUrl}}{{item.images}}"/></i>{{item.name}}
			            	  {{else}}
			            	  <i class="icon"><img src="../../images/icon/life_housekeeper/vg-img1.png"/></i>{{item.name}}
			            	  {{/if}}
			            	{{else if (i+1)%3 == 2}}
			            	  {{if item.images}}
			            	  <i class="icon"><img src="{{baseUrl}}{{item.images}}"/></i>{{item.name}}
			            	  {{else}}
			            	  <i class="icon"><img src="../../images/icon/life_housekeeper/vg-img2.png"/></i>{{item.name}}
			            	  {{/if}}
			        		{{else if (i+1)%3 == 0}}
			        		  {{if item.images}}
			            	  <i class="icon"><img src="{{baseUrl}}{{item.images}}"/></i>{{item.name}}
			            	  {{else}}
			            	  <i class="icon"><img src="../../images/icon/life_housekeeper/vg-img3.png"/></i>{{item.name}}
			            	  {{/if}}
			            	{{/if}}	
			            </a>
			        </li>
			        {{/each}}
			    {{else}}
 				{{/if}}   
		    </ul>
		</script>
		<script>
			mui.init();
			mui.plusReady(function(){
				
				myAjax('/home/vegetable/managelist','get',{},function(e){
					console.log(e);
					var res = JSON.parse(e);
					if(res.code == 1){
						res.baseUrl = _baseUrl;
						var listHtml =  template('list',res);
						document.getElementById("contentList").innerHTML = listHtml;
					}
				});

				mui(".mui-content").on('tap','a',function(){
					var _this = this,
					childNode = _this.innerText,
					dataId = _this.getAttribute('data-id'),
					dataHref=  _this.getAttribute('data-href');
					
//					return;
					
					if(dataHref && dataHref.indexOf('http'||'https')> -1){
						var viewOptions = {
							url:'detail.html',
							id:'detail.html'
							},
						extra = {
							link:dataHref,
							title:childNode
						},
						titleOptions = {
							title:childNode
						};
						mui.addTitleView(viewOptions,extra,titleOptions);
						return;
					}
					if(!dataId || dataId == ''){
						return;
					}
					var viewOptions = {
						url:'vegetable_query.html',
						id:'vegetable_query'
					},
					extra = {
						dataId:dataId,
						title:childNode
					},
					titleOptions = {
						title:childNode
					};
					mui.addTitleView(viewOptions,extra,titleOptions);
				})
			})
		</script>
	</body>
</html>
